package com.zzy.demo.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@ConfigurationProperties(prefix = "author")
@Component
public class AuthorConfig implements  ApplicationListener<ContextRefreshedEvent>{
	
	private String name;
	
	private Integer age;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	@Override
	public void onApplicationEvent(ContextRefreshedEvent event) {
		System.out.println("自定义配置参数:-------------"+this.name+"----------"+this.age);
	}
	
	
	
	

}
